import { TYPE_PDF, TYPE_OFFICE, TYPE_IMAGE } from './attachment'

export default {
  table: 'template',
  columns: [
    {
      key: 'id'
    },
    {
      key: 'ie_attachment.id'
    },
    {
      title: '文件名',
      key: 'ie_attachment.filename'
    },
    {
      title: '书签',
      key: 'bookmarks',
      nullValue: '无'
    },
    {
      title: '文件后缀',
      key: 'ie_attachment.ext',
      width: 100
    },
    {
      title: '文件预览',
      key: 'ie_attachment.filepath',
      type: 'file'
    },
    {
      title: '所属部门',
      key: 'department.name'
    },
    {
      title: '上传时间',
      key: 'create_at',
      type: 'date',
      sorter: true
    }
  ],
  queryOptions: {
    'ie_attachment.ext': {
      type: 'select',
      options: [
        ...TYPE_PDF,
        ...TYPE_OFFICE,
        ...TYPE_IMAGE
      ].map(v => ({
        label: v.toUpperCase(),
        value: v
      })),
      multiple: true
    },
    create_at: {
      type: 'daterange',
      format: 'yyyy-MM-dd'
    }
  }
}